﻿<UserControl x:Class="LEShortcut.Pages.Home"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:si="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:cmd="clr-namespace:LEShortcut.Actions"
             mc:Ignorable="d"
             d:DesignHeight="520" d:DesignWidth="720">
    <Grid Name="Grid" Style="{StaticResource ContentRoot}">
        <Grid.RowDefinitions>
            <RowDefinition Height="0" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="9*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="18*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <Grid Row="1" Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Label Content="{DynamicResource TargetLabel}" />
            <Grid Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="17*" />
                    <ColumnDefinition Width="3*" />
                </Grid.ColumnDefinitions>
                <TextBox Text="{Binding Context.FilePath}" Margin="0,0,5,0" AllowDrop="True">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="PreviewDragOver">
                            <cmd:EventCommand Command="{Binding AllwDragCommand}"
                                              CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=InvokeParameter}" />
                        </i:EventTrigger>
                        <i:EventTrigger EventName="PreviewDrop">
                            <si:CallMethodAction TargetObject="{Binding}" MethodName="DragDropCommand" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </TextBox>
                <Button Grid.Column="1" Content="{DynamicResource BrowseButtonContent}" Margin="5,0,0,0" Padding="0"
                        Command="{Binding BrowseCommand}"
                        CommandParameter="{Binding Context}" />
            </Grid>
        </Grid>
        <Grid Row="3" Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Label Content="{DynamicResource NameLabel}" />
            <TextBox Grid.Row="1" Text="{Binding Context.FileName}" />
        </Grid>
        <Grid Row="5" Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="1.5*" />
                <RowDefinition Height="7.5*" />
            </Grid.RowDefinitions>
            <Label Content="{DynamicResource DescrpitionLabel}" />
            <TextBox Grid.Row="1" Text="{Binding Context.Description}" AcceptsReturn="True" />
        </Grid>
        <Grid Row="7" Column="1">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Label Content="{DynamicResource StartupProfileLabel}" />
            <ComboBox Grid.Row="1" ItemsSource="{Binding Context.LeConfig}"
                      DisplayMemberPath="Attribute[Name].Value" SelectedValuePath="Attribute[Guid].Value">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <si:CallMethodAction MethodName="ProfileSelectionChanged" TargetObject="{Binding}" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </ComboBox>
        </Grid>
        <Grid Row="9" Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Button Grid.Column="1" Content="{DynamicResource CreateButtonContent}"
                    CommandParameter="{Binding Context}"
                    Command="{Binding SaveShortcutCommand}" />
        </Grid>
    </Grid>
</UserControl>